<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Source code</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<main role="main">
<div class="sourceContainer">
<pre><span class="sourceLineNo">001</span><a id="line.1">/*</a>
<span class="sourceLineNo">002</span><a id="line.2"> * Licensed to the Apache Software Foundation (ASF) under one or more</a>
<span class="sourceLineNo">003</span><a id="line.3"> * contributor license agreements.  See the NOTICE file distributed with</a>
<span class="sourceLineNo">004</span><a id="line.4"> * this work for additional information regarding copyright ownership.</a>
<span class="sourceLineNo">005</span><a id="line.5"> * The ASF licenses this file to You under the Apache License, Version 2.0</a>
<span class="sourceLineNo">006</span><a id="line.6"> * (the "License"); you may not use this file except in compliance with</a>
<span class="sourceLineNo">007</span><a id="line.7"> * the License.  You may obtain a copy of the License at</a>
<span class="sourceLineNo">008</span><a id="line.8"> *</a>
<span class="sourceLineNo">009</span><a id="line.9"> *      http://www.apache.org/licenses/LICENSE-2.0</a>
<span class="sourceLineNo">010</span><a id="line.10"> *</a>
<span class="sourceLineNo">011</span><a id="line.11"> * Unless required by applicable law or agreed to in writing, software</a>
<span class="sourceLineNo">012</span><a id="line.12"> * distributed under the License is distributed on an "AS IS" BASIS,</a>
<span class="sourceLineNo">013</span><a id="line.13"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</a>
<span class="sourceLineNo">014</span><a id="line.14"> * See the License for the specific language governing permissions and</a>
<span class="sourceLineNo">015</span><a id="line.15"> * limitations under the License.</a>
<span class="sourceLineNo">016</span><a id="line.16"> */</a>
<span class="sourceLineNo">017</span><a id="line.17">package org.apache.commons.dbutils;</a>
<span class="sourceLineNo">018</span><a id="line.18"></a>
<span class="sourceLineNo">019</span><a id="line.19">import java.sql.ResultSet;</a>
<span class="sourceLineNo">020</span><a id="line.20">import java.sql.ResultSetMetaData;</a>
<span class="sourceLineNo">021</span><a id="line.21">import java.sql.SQLException;</a>
<span class="sourceLineNo">022</span><a id="line.22">import java.util.HashMap;</a>
<span class="sourceLineNo">023</span><a id="line.23">import java.util.LinkedHashMap;</a>
<span class="sourceLineNo">024</span><a id="line.24">import java.util.List;</a>
<span class="sourceLineNo">025</span><a id="line.25">import java.util.Locale;</a>
<span class="sourceLineNo">026</span><a id="line.26">import java.util.Map;</a>
<span class="sourceLineNo">027</span><a id="line.27"></a>
<span class="sourceLineNo">028</span><a id="line.28">/**</a>
<span class="sourceLineNo">029</span><a id="line.29"> * Basic implementation of the {@code RowProcessor} interface.</a>
<span class="sourceLineNo">030</span><a id="line.30"> *</a>
<span class="sourceLineNo">031</span><a id="line.31"> * &lt;p&gt;</a>
<span class="sourceLineNo">032</span><a id="line.32"> * This class is thread-safe.</a>
<span class="sourceLineNo">033</span><a id="line.33"> * &lt;/p&gt;</a>
<span class="sourceLineNo">034</span><a id="line.34"> *</a>
<span class="sourceLineNo">035</span><a id="line.35"> * @see RowProcessor</a>
<span class="sourceLineNo">036</span><a id="line.36"> */</a>
<span class="sourceLineNo">037</span><a id="line.37">public class BasicRowProcessor implements RowProcessor {</a>
<span class="sourceLineNo">038</span><a id="line.38"></a>
<span class="sourceLineNo">039</span><a id="line.39">    /**</a>
<span class="sourceLineNo">040</span><a id="line.40">     * The default BeanProcessor instance to use if not supplied in the</a>
<span class="sourceLineNo">041</span><a id="line.41">     * constructor.</a>
<span class="sourceLineNo">042</span><a id="line.42">     */</a>
<span class="sourceLineNo">043</span><a id="line.43">    private static final BeanProcessor defaultConvert = new BeanProcessor();</a>
<span class="sourceLineNo">044</span><a id="line.44"></a>
<span class="sourceLineNo">045</span><a id="line.45">    /**</a>
<span class="sourceLineNo">046</span><a id="line.46">     * The Singleton instance of this class.</a>
<span class="sourceLineNo">047</span><a id="line.47">     */</a>
<span class="sourceLineNo">048</span><a id="line.48">    private static final BasicRowProcessor instance = new BasicRowProcessor();</a>
<span class="sourceLineNo">049</span><a id="line.49"></a>
<span class="sourceLineNo">050</span><a id="line.50">    protected static Map&lt;String, Object&gt; createCaseInsensitiveHashMap(final int cols) {</a>
<span class="sourceLineNo">051</span><a id="line.51">        return new CaseInsensitiveHashMap(cols);</a>
<span class="sourceLineNo">052</span><a id="line.52">    }</a>
<span class="sourceLineNo">053</span><a id="line.53"></a>
<span class="sourceLineNo">054</span><a id="line.54">    /**</a>
<span class="sourceLineNo">055</span><a id="line.55">     * Returns the Singleton instance of this class.</a>
<span class="sourceLineNo">056</span><a id="line.56">     *</a>
<span class="sourceLineNo">057</span><a id="line.57">     * @return The single instance of this class.</a>
<span class="sourceLineNo">058</span><a id="line.58">     * @deprecated Create instances with the constructors instead.  This will</a>
<span class="sourceLineNo">059</span><a id="line.59">     * be removed after DbUtils 1.1.</a>
<span class="sourceLineNo">060</span><a id="line.60">     */</a>
<span class="sourceLineNo">061</span><a id="line.61">    @Deprecated</a>
<span class="sourceLineNo">062</span><a id="line.62">    public static BasicRowProcessor instance() {</a>
<span class="sourceLineNo">063</span><a id="line.63">        return instance;</a>
<span class="sourceLineNo">064</span><a id="line.64">    }</a>
<span class="sourceLineNo">065</span><a id="line.65"></a>
<span class="sourceLineNo">066</span><a id="line.66">    /**</a>
<span class="sourceLineNo">067</span><a id="line.67">     * Use this to process beans.</a>
<span class="sourceLineNo">068</span><a id="line.68">     */</a>
<span class="sourceLineNo">069</span><a id="line.69">    private final BeanProcessor convert;</a>
<span class="sourceLineNo">070</span><a id="line.70"></a>
<span class="sourceLineNo">071</span><a id="line.71">    /**</a>
<span class="sourceLineNo">072</span><a id="line.72">     * BasicRowProcessor constructor.  Bean processing defaults to a</a>
<span class="sourceLineNo">073</span><a id="line.73">     * BeanProcessor instance.</a>
<span class="sourceLineNo">074</span><a id="line.74">     */</a>
<span class="sourceLineNo">075</span><a id="line.75">    public BasicRowProcessor() {</a>
<span class="sourceLineNo">076</span><a id="line.76">        this(defaultConvert);</a>
<span class="sourceLineNo">077</span><a id="line.77">    }</a>
<span class="sourceLineNo">078</span><a id="line.78"></a>
<span class="sourceLineNo">079</span><a id="line.79">    /**</a>
<span class="sourceLineNo">080</span><a id="line.80">     * BasicRowProcessor constructor.</a>
<span class="sourceLineNo">081</span><a id="line.81">     * @param convert The BeanProcessor to use when converting columns to</a>
<span class="sourceLineNo">082</span><a id="line.82">     * bean properties.</a>
<span class="sourceLineNo">083</span><a id="line.83">     * @since DbUtils 1.1</a>
<span class="sourceLineNo">084</span><a id="line.84">     */</a>
<span class="sourceLineNo">085</span><a id="line.85">    public BasicRowProcessor(final BeanProcessor convert) {</a>
<span class="sourceLineNo">086</span><a id="line.86">        super();</a>
<span class="sourceLineNo">087</span><a id="line.87">        this.convert = convert;</a>
<span class="sourceLineNo">088</span><a id="line.88">    }</a>
<span class="sourceLineNo">089</span><a id="line.89"></a>
<span class="sourceLineNo">090</span><a id="line.90">    /**</a>
<span class="sourceLineNo">091</span><a id="line.91">     * Convert a {@code ResultSet} row into an {@code Object[]}.</a>
<span class="sourceLineNo">092</span><a id="line.92">     * This implementation copies column values into the array in the same</a>
<span class="sourceLineNo">093</span><a id="line.93">     * order they're returned from the {@code ResultSet}.  Array elements</a>
<span class="sourceLineNo">094</span><a id="line.94">     * will be set to {@code null} if the column was SQL NULL.</a>
<span class="sourceLineNo">095</span><a id="line.95">     *</a>
<span class="sourceLineNo">096</span><a id="line.96">     * @see org.apache.commons.dbutils.RowProcessor#toArray(java.sql.ResultSet)</a>
<span class="sourceLineNo">097</span><a id="line.97">     * @param rs ResultSet that supplies the array data</a>
<span class="sourceLineNo">098</span><a id="line.98">     * @throws SQLException if a database access error occurs</a>
<span class="sourceLineNo">099</span><a id="line.99">     * @return the newly created array</a>
<span class="sourceLineNo">100</span><a id="line.100">     */</a>
<span class="sourceLineNo">101</span><a id="line.101">    @Override</a>
<span class="sourceLineNo">102</span><a id="line.102">    public Object[] toArray(final ResultSet rs) throws SQLException {</a>
<span class="sourceLineNo">103</span><a id="line.103">        final ResultSetMetaData meta = rs.getMetaData();</a>
<span class="sourceLineNo">104</span><a id="line.104">        final int cols = meta.getColumnCount();</a>
<span class="sourceLineNo">105</span><a id="line.105">        final Object[] result = new Object[cols];</a>
<span class="sourceLineNo">106</span><a id="line.106"></a>
<span class="sourceLineNo">107</span><a id="line.107">        for (int i = 0; i &lt; cols; i++) {</a>
<span class="sourceLineNo">108</span><a id="line.108">            result[i] = rs.getObject(i + 1);</a>
<span class="sourceLineNo">109</span><a id="line.109">        }</a>
<span class="sourceLineNo">110</span><a id="line.110"></a>
<span class="sourceLineNo">111</span><a id="line.111">        return result;</a>
<span class="sourceLineNo">112</span><a id="line.112">    }</a>
<span class="sourceLineNo">113</span><a id="line.113"></a>
<span class="sourceLineNo">114</span><a id="line.114">    /**</a>
<span class="sourceLineNo">115</span><a id="line.115">     * Convert a {@code ResultSet} row into a JavaBean.  This</a>
<span class="sourceLineNo">116</span><a id="line.116">     * implementation delegates to a BeanProcessor instance.</a>
<span class="sourceLineNo">117</span><a id="line.117">     * @see org.apache.commons.dbutils.RowProcessor#toBean(java.sql.ResultSet, java.lang.Class)</a>
<span class="sourceLineNo">118</span><a id="line.118">     * @see org.apache.commons.dbutils.BeanProcessor#toBean(java.sql.ResultSet, java.lang.Class)</a>
<span class="sourceLineNo">119</span><a id="line.119">     * @param &lt;T&gt; The type of bean to create</a>
<span class="sourceLineNo">120</span><a id="line.120">     * @param rs ResultSet that supplies the bean data</a>
<span class="sourceLineNo">121</span><a id="line.121">     * @param type Class from which to create the bean instance</a>
<span class="sourceLineNo">122</span><a id="line.122">     * @throws SQLException if a database access error occurs</a>
<span class="sourceLineNo">123</span><a id="line.123">     * @return the newly created bean</a>
<span class="sourceLineNo">124</span><a id="line.124">     */</a>
<span class="sourceLineNo">125</span><a id="line.125">    @Override</a>
<span class="sourceLineNo">126</span><a id="line.126">    public &lt;T&gt; T toBean(final ResultSet rs, final Class&lt;? extends T&gt; type) throws SQLException {</a>
<span class="sourceLineNo">127</span><a id="line.127">        return this.convert.toBean(rs, type);</a>
<span class="sourceLineNo">128</span><a id="line.128">    }</a>
<span class="sourceLineNo">129</span><a id="line.129"></a>
<span class="sourceLineNo">130</span><a id="line.130">    /**</a>
<span class="sourceLineNo">131</span><a id="line.131">     * Convert a {@code ResultSet} into a {@code List} of JavaBeans.</a>
<span class="sourceLineNo">132</span><a id="line.132">     * This implementation delegates to a BeanProcessor instance.</a>
<span class="sourceLineNo">133</span><a id="line.133">     * @see org.apache.commons.dbutils.RowProcessor#toBeanList(java.sql.ResultSet, java.lang.Class)</a>
<span class="sourceLineNo">134</span><a id="line.134">     * @see org.apache.commons.dbutils.BeanProcessor#toBeanList(java.sql.ResultSet, java.lang.Class)</a>
<span class="sourceLineNo">135</span><a id="line.135">     * @param &lt;T&gt; The type of bean to create</a>
<span class="sourceLineNo">136</span><a id="line.136">     * @param rs ResultSet that supplies the bean data</a>
<span class="sourceLineNo">137</span><a id="line.137">     * @param type Class from which to create the bean instance</a>
<span class="sourceLineNo">138</span><a id="line.138">     * @throws SQLException if a database access error occurs</a>
<span class="sourceLineNo">139</span><a id="line.139">     * @return A {@code List} of beans with the given type in the order</a>
<span class="sourceLineNo">140</span><a id="line.140">     * they were returned by the {@code ResultSet}.</a>
<span class="sourceLineNo">141</span><a id="line.141">     */</a>
<span class="sourceLineNo">142</span><a id="line.142">    @Override</a>
<span class="sourceLineNo">143</span><a id="line.143">    public &lt;T&gt; List&lt;T&gt; toBeanList(final ResultSet rs, final Class&lt;? extends T&gt; type) throws SQLException {</a>
<span class="sourceLineNo">144</span><a id="line.144">        return this.convert.toBeanList(rs, type);</a>
<span class="sourceLineNo">145</span><a id="line.145">    }</a>
<span class="sourceLineNo">146</span><a id="line.146"></a>
<span class="sourceLineNo">147</span><a id="line.147">    /**</a>
<span class="sourceLineNo">148</span><a id="line.148">     * Convert a {@code ResultSet} row into a {@code Map}.</a>
<span class="sourceLineNo">149</span><a id="line.149">     *</a>
<span class="sourceLineNo">150</span><a id="line.150">     * &lt;p&gt;</a>
<span class="sourceLineNo">151</span><a id="line.151">     * This implementation returns a {@code Map} with case insensitive column names as keys. Calls to</a>
<span class="sourceLineNo">152</span><a id="line.152">     * {@code map.get("COL")} and {@code map.get("col")} return the same value. Furthermore this implementation</a>
<span class="sourceLineNo">153</span><a id="line.153">     * will return an ordered map, that preserves the ordering of the columns in the ResultSet, so that iterating over</a>
<span class="sourceLineNo">154</span><a id="line.154">     * the entry set of the returned map will return the first column of the ResultSet, then the second and so forth.</a>
<span class="sourceLineNo">155</span><a id="line.155">     * &lt;/p&gt;</a>
<span class="sourceLineNo">156</span><a id="line.156">     *</a>
<span class="sourceLineNo">157</span><a id="line.157">     * @param rs ResultSet that supplies the map data</a>
<span class="sourceLineNo">158</span><a id="line.158">     * @return the newly created Map</a>
<span class="sourceLineNo">159</span><a id="line.159">     * @throws SQLException if a database access error occurs</a>
<span class="sourceLineNo">160</span><a id="line.160">     * @see org.apache.commons.dbutils.RowProcessor#toMap(java.sql.ResultSet)</a>
<span class="sourceLineNo">161</span><a id="line.161">     */</a>
<span class="sourceLineNo">162</span><a id="line.162">    @Override</a>
<span class="sourceLineNo">163</span><a id="line.163">    public Map&lt;String, Object&gt; toMap(final ResultSet rs) throws SQLException {</a>
<span class="sourceLineNo">164</span><a id="line.164">        final ResultSetMetaData rsmd = rs.getMetaData();</a>
<span class="sourceLineNo">165</span><a id="line.165">        final int cols = rsmd.getColumnCount();</a>
<span class="sourceLineNo">166</span><a id="line.166">        final Map&lt;String, Object&gt; result = createCaseInsensitiveHashMap(cols);</a>
<span class="sourceLineNo">167</span><a id="line.167"></a>
<span class="sourceLineNo">168</span><a id="line.168">        for (int i = 1; i &lt;= cols; i++) {</a>
<span class="sourceLineNo">169</span><a id="line.169">            String columnName = rsmd.getColumnLabel(i);</a>
<span class="sourceLineNo">170</span><a id="line.170">            if (null == columnName || 0 == columnName.length()) {</a>
<span class="sourceLineNo">171</span><a id="line.171">              columnName = rsmd.getColumnName(i);</a>
<span class="sourceLineNo">172</span><a id="line.172">            }</a>
<span class="sourceLineNo">173</span><a id="line.173">            result.put(columnName, rs.getObject(i));</a>
<span class="sourceLineNo">174</span><a id="line.174">        }</a>
<span class="sourceLineNo">175</span><a id="line.175"></a>
<span class="sourceLineNo">176</span><a id="line.176">        return result;</a>
<span class="sourceLineNo">177</span><a id="line.177">    }</a>
<span class="sourceLineNo">178</span><a id="line.178"></a>
<span class="sourceLineNo">179</span><a id="line.179"></a>
<span class="sourceLineNo">180</span><a id="line.180">    /**</a>
<span class="sourceLineNo">181</span><a id="line.181">     * A Map that converts all keys to lowercase Strings for case insensitive</a>
<span class="sourceLineNo">182</span><a id="line.182">     * lookups.  This is needed for the toMap() implementation because</a>
<span class="sourceLineNo">183</span><a id="line.183">     * databases don't consistently handle the casing of column names.</a>
<span class="sourceLineNo">184</span><a id="line.184">     *</a>
<span class="sourceLineNo">185</span><a id="line.185">     * &lt;p&gt;The keys are stored as they are given [BUG #DBUTILS-34], so we maintain</a>
<span class="sourceLineNo">186</span><a id="line.186">     * an internal mapping from lowercase keys to the real keys in order to</a>
<span class="sourceLineNo">187</span><a id="line.187">     * achieve the case insensitive lookup.</a>
<span class="sourceLineNo">188</span><a id="line.188">     *</a>
<span class="sourceLineNo">189</span><a id="line.189">     * &lt;p&gt;Note: This implementation does not allow {@code null}</a>
<span class="sourceLineNo">190</span><a id="line.190">     * for key, whereas {@link LinkedHashMap} does, because of the code:</a>
<span class="sourceLineNo">191</span><a id="line.191">     * &lt;pre&gt;</a>
<span class="sourceLineNo">192</span><a id="line.192">     * key.toString().toLowerCase()</a>
<span class="sourceLineNo">193</span><a id="line.193">     * &lt;/pre&gt;</a>
<span class="sourceLineNo">194</span><a id="line.194">     */</a>
<span class="sourceLineNo">195</span><a id="line.195">    private static final class CaseInsensitiveHashMap extends LinkedHashMap&lt;String, Object&gt; {</a>
<span class="sourceLineNo">196</span><a id="line.196"></a>
<span class="sourceLineNo">197</span><a id="line.197">        private CaseInsensitiveHashMap(final int initialCapacity) {</a>
<span class="sourceLineNo">198</span><a id="line.198">            super(initialCapacity);</a>
<span class="sourceLineNo">199</span><a id="line.199">        }</a>
<span class="sourceLineNo">200</span><a id="line.200"></a>
<span class="sourceLineNo">201</span><a id="line.201">        /**</a>
<span class="sourceLineNo">202</span><a id="line.202">         * The internal mapping from lowercase keys to the real keys.</a>
<span class="sourceLineNo">203</span><a id="line.203">         *</a>
<span class="sourceLineNo">204</span><a id="line.204">         * &lt;p&gt;</a>
<span class="sourceLineNo">205</span><a id="line.205">         * Any query operation using the key</a>
<span class="sourceLineNo">206</span><a id="line.206">         * ({@link #get(Object)}, {@link #containsKey(Object)})</a>
<span class="sourceLineNo">207</span><a id="line.207">         * is done in three steps:</a>
<span class="sourceLineNo">208</span><a id="line.208">         * &lt;ul&gt;</a>
<span class="sourceLineNo">209</span><a id="line.209">         * &lt;li&gt;convert the parameter key to lower case&lt;/li&gt;</a>
<span class="sourceLineNo">210</span><a id="line.210">         * &lt;li&gt;get the actual key that corresponds to the lower case key&lt;/li&gt;</a>
<span class="sourceLineNo">211</span><a id="line.211">         * &lt;li&gt;query the map with the actual key&lt;/li&gt;</a>
<span class="sourceLineNo">212</span><a id="line.212">         * &lt;/ul&gt;</a>
<span class="sourceLineNo">213</span><a id="line.213">         * &lt;/p&gt;</a>
<span class="sourceLineNo">214</span><a id="line.214">         */</a>
<span class="sourceLineNo">215</span><a id="line.215">        private final Map&lt;String, String&gt; lowerCaseMap = new HashMap&lt;&gt;();</a>
<span class="sourceLineNo">216</span><a id="line.216"></a>
<span class="sourceLineNo">217</span><a id="line.217">        /**</a>
<span class="sourceLineNo">218</span><a id="line.218">         * Required for serialization support.</a>
<span class="sourceLineNo">219</span><a id="line.219">         *</a>
<span class="sourceLineNo">220</span><a id="line.220">         * @see java.io.Serializable</a>
<span class="sourceLineNo">221</span><a id="line.221">         */</a>
<span class="sourceLineNo">222</span><a id="line.222">        private static final long serialVersionUID = -2848100435296897392L;</a>
<span class="sourceLineNo">223</span><a id="line.223"></a>
<span class="sourceLineNo">224</span><a id="line.224">        /** {@inheritDoc} */</a>
<span class="sourceLineNo">225</span><a id="line.225">        @Override</a>
<span class="sourceLineNo">226</span><a id="line.226">        public boolean containsKey(final Object key) {</a>
<span class="sourceLineNo">227</span><a id="line.227">            final Object realKey = lowerCaseMap.get(key.toString().toLowerCase(Locale.ENGLISH));</a>
<span class="sourceLineNo">228</span><a id="line.228">            return super.containsKey(realKey);</a>
<span class="sourceLineNo">229</span><a id="line.229">            // Possible optimisation here:</a>
<span class="sourceLineNo">230</span><a id="line.230">            // Since the lowerCaseMap contains a mapping for all the keys,</a>
<span class="sourceLineNo">231</span><a id="line.231">            // we could just do this:</a>
<span class="sourceLineNo">232</span><a id="line.232">            // return lowerCaseMap.containsKey(key.toString().toLowerCase());</a>
<span class="sourceLineNo">233</span><a id="line.233">        }</a>
<span class="sourceLineNo">234</span><a id="line.234"></a>
<span class="sourceLineNo">235</span><a id="line.235">        /** {@inheritDoc} */</a>
<span class="sourceLineNo">236</span><a id="line.236">        @Override</a>
<span class="sourceLineNo">237</span><a id="line.237">        public Object get(final Object key) {</a>
<span class="sourceLineNo">238</span><a id="line.238">            final Object realKey = lowerCaseMap.get(key.toString().toLowerCase(Locale.ENGLISH));</a>
<span class="sourceLineNo">239</span><a id="line.239">            return super.get(realKey);</a>
<span class="sourceLineNo">240</span><a id="line.240">        }</a>
<span class="sourceLineNo">241</span><a id="line.241"></a>
<span class="sourceLineNo">242</span><a id="line.242">        /** {@inheritDoc} */</a>
<span class="sourceLineNo">243</span><a id="line.243">        @Override</a>
<span class="sourceLineNo">244</span><a id="line.244">        public Object put(final String key, final Object value) {</a>
<span class="sourceLineNo">245</span><a id="line.245">            /*</a>
<span class="sourceLineNo">246</span><a id="line.246">             * In order to keep the map and lowerCaseMap synchronized,</a>
<span class="sourceLineNo">247</span><a id="line.247">             * we have to remove the old mapping before putting the</a>
<span class="sourceLineNo">248</span><a id="line.248">             * new one. Indeed, oldKey and key are not necessaliry equals.</a>
<span class="sourceLineNo">249</span><a id="line.249">             * (That's why we call super.remove(oldKey) and not just</a>
<span class="sourceLineNo">250</span><a id="line.250">             * super.put(key, value))</a>
<span class="sourceLineNo">251</span><a id="line.251">             */</a>
<span class="sourceLineNo">252</span><a id="line.252">            final Object oldKey = lowerCaseMap.put(key.toLowerCase(Locale.ENGLISH), key);</a>
<span class="sourceLineNo">253</span><a id="line.253">            final Object oldValue = super.remove(oldKey);</a>
<span class="sourceLineNo">254</span><a id="line.254">            super.put(key, value);</a>
<span class="sourceLineNo">255</span><a id="line.255">            return oldValue;</a>
<span class="sourceLineNo">256</span><a id="line.256">        }</a>
<span class="sourceLineNo">257</span><a id="line.257"></a>
<span class="sourceLineNo">258</span><a id="line.258">        /** {@inheritDoc} */</a>
<span class="sourceLineNo">259</span><a id="line.259">        @Override</a>
<span class="sourceLineNo">260</span><a id="line.260">        public void putAll(final Map&lt;? extends String, ?&gt; m) {</a>
<span class="sourceLineNo">261</span><a id="line.261">            for (final Map.Entry&lt;? extends String, ?&gt; entry : m.entrySet()) {</a>
<span class="sourceLineNo">262</span><a id="line.262">                final String key = entry.getKey();</a>
<span class="sourceLineNo">263</span><a id="line.263">                final Object value = entry.getValue();</a>
<span class="sourceLineNo">264</span><a id="line.264">                this.put(key, value);</a>
<span class="sourceLineNo">265</span><a id="line.265">            }</a>
<span class="sourceLineNo">266</span><a id="line.266">        }</a>
<span class="sourceLineNo">267</span><a id="line.267"></a>
<span class="sourceLineNo">268</span><a id="line.268">        /** {@inheritDoc} */</a>
<span class="sourceLineNo">269</span><a id="line.269">        @Override</a>
<span class="sourceLineNo">270</span><a id="line.270">        public Object remove(final Object key) {</a>
<span class="sourceLineNo">271</span><a id="line.271">            final Object realKey = lowerCaseMap.remove(key.toString().toLowerCase(Locale.ENGLISH));</a>
<span class="sourceLineNo">272</span><a id="line.272">            return super.remove(realKey);</a>
<span class="sourceLineNo">273</span><a id="line.273">        }</a>
<span class="sourceLineNo">274</span><a id="line.274">    }</a>
<span class="sourceLineNo">275</span><a id="line.275"></a>
<span class="sourceLineNo">276</span><a id="line.276">}</a>




























































</pre>
</div>
</main>
</body>
</html>
